//
//  XLHomeTitleHeaderView.m
//  industry
//
//  Created by xl on 2020/11/25.
//  Copyright © 2020 Haier. All rights reserved.
//

#import "XLHomeTitleHeaderView.h"


@interface XLHomeTitleHeaderView ()

@property (nonatomic, strong) XLView *lineView;
@property (nonatomic, strong) XLLabel *titleLB;

@end
@implementation XLHomeTitleHeaderView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteBgColor];
        
        [self addSubview:self.lineView];
        [self addSubview:self.titleLB];
        
        [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(30);
            make.centerY.equalTo(self);
            make.size.mas_equalTo(CGSizeMake(3, 14));
        }];
        
        [_titleLB mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.lineView.mas_right).offset(10);
            make.centerY.equalTo(self);
        }];
        
        [_titleLB sizeToFit];
    }
    return self;
}

#pragma mark - Public
- (void)loadHeaderViewTitle:(NSString *)title {
    _titleLB.text = title;
}

#pragma mark - setter/getter
- (XLView *)lineView {
    if (!_lineView) {
        _lineView = [XLView new];
        _lineView.backgroundColor = [UIColor blueBgColor];
        _lineView.layer.cornerRadius = 1.5;
        _lineView.layer.masksToBounds = YES;
    }
    return _lineView;
}

- (XLLabel *)titleLB {
    if (!_titleLB) {
        _titleLB = [XLLabel new];
        _titleLB.font = [UIFont fontOfPingFangSCRegularWithSize:15];
        _titleLB.textColor = [UIColor blackFontColor];
    }
    return _titleLB;
}

@end
